Learn how to use rules to hide records based on the value of specific attributes.
Sometimes, you may want to use a rule to hide records based on what users are searching for.
For example, consider a user searching for “cheap laptops” on an ecommerce site. Without a rule, cheap and premium laptops will appear in the search results.
By applying a rule where:
Condition: query contains “cheap”
Consequence: hide items where the product_range attribute is premium
Users searching for cheap laptops will only see the more affordable options in the search results.To hide one or more items, use an Algolia API client or the Algolia dashboard’s Visual Editor.
You can also hide individual items with the Algolia dashboard’s Manual Editor.
Select the Rules section from the left sidebar menu in the Algolia dashboard.
Under the heading Rules, specify the index where you want to add the rule.
Select Create your first rule or New rule. In the drop-down menu, click the Manual Editor option.
In the Condition(s) section, keep Query toggled on, select Contains in the drop-down menu, and type your query in the input field (for example, cheap).